<!--
  @author heguanghua
  @since 2019/06/12 11:57
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<body>

<div class="layui-fluid">

    <blockquote class="layui-crumb">
        渠道管理>
        <a lay-href="/channel/list.action">渠道管理</a>>
        <a th:href="'/channel/detail.action?channelId='+${obj.channelId}">[[${obj.name}]]</a>>
        <zmn th:text="渠道价格">渠道价格</zmn>
    </blockquote>

    <div class="layui-card">
        <div class="layui-card-body">
            <div th:replace="channel/_tab::tab"></div>
            <div class="layui-card-header layuiadmin-card-header-auto" style="margin-top:10px;"><b>
                产品价格 = 渠道价格 x 渠道价格系数或渠道城市系数，如渠道价格系数设置为0，且未设置渠道城市系数，则：产品价格 = 渠道价格 x 基础城市价格系数；
                渠道城市系数优先级高于渠道价格系数，如未设置渠道城市系数，则使用渠道价格系数，如未设置渠道价格系数，则直接使用渠道价格。
                如有设置渠道折扣系数，产品价格=渠道价格×渠道价格系数或渠道城市系数/基础城市价格系数×渠道折扣系数</b>
            </div>
            <div th:replace="channel/price/faultprice/_table::table"></div>
            <script type="text/html" id="zmn-table-tool">
                <div class="layui-btn-container">
                </div>
            </script>
        </div>

    </div>

</div>
</body>
</html>

<script type="text/javascript" th:inline="javascript">

    var json = {
        channelId: [[${channelId}]],
        addFlag: [[${addFlag}]],
    };

    layui.config({
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
    }).use(['index', 'form', 'layer', 'table'], function(){
        let $ = layui.$;
        let form = layui.form;
        let layer = layui.layer;
        let table = layui.table;
        form.render(null, "zmn-form");

        table.init('zmn-table', {
            toolbar: "#zmn-table-tool",
            page: false,
            limit: 2,

        });

        table.on('tool(zmn-table)', function (obj) {
            if (obj.event === 'listTable') {

            } else if (obj.event === 'selectTable') {
                openPriceTable(1, obj.data.keepType);
            }
        });

        let openPriceTable = function (type, keepType) {
            zmnLayUtil.openIframeCustom(layer, "/channel/price/faultprice/select.action?channelId=" + json.channelId + "&keepType=" + keepType, {
                title: "选择价格表",
                area: ['60%', '50%'],
                id: 123
            })
        };


    });

</script>

<script type="text/html" id="zmn-table-bar">
    <a style="color: #00a0e9" lay-href="/channel/price/faultprice/detail/list?channelId={{json.channelId}}&keepType={{d.keepType}}&tariffId={{d.tariffId}}">查看价格表</a> &nbsp;&nbsp;
    <a style="color: #00a0e9" lay-event="selectTable">选择价格表</a>
</script>
